package demo2;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

@Component
@PropertySource("classpath:config.properties")

public class Student {

private int id;
private String name;

    public int getId() {
        return id;
    }
    @Value("${student.age}")
    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }
    @Value("${student.name}")
    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
}
